package com.gxa.o2o.core.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gxa.o2o.core.groups.AddUserGroup;
import com.gxa.o2o.core.groups.UpdateUserGroup;
import com.gxa.o2o.core.groups.UserLogin;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * @author 阔爱又迷人的川锅锅呀
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "user")
public class User implements Serializable {

    @Column(name = "user_id")
    @Id
    private String id;

    @Column(name = "user_phone")
    @NotEmpty(message = "用户手机号不能为空",groups = {AddUserGroup.class, UpdateUserGroup.class})
    @Pattern(regexp = "^[1](([3][0-9])|([4][5,7,9])|([5][0-9])|([6][6])|([7][3,5,6,7,8])|([8][0-9])|([9][8,9]))[0-9]{8}$",groups = {AddUserGroup.class,UpdateUserGroup.class, UserLogin.class})
    private String phone;

    @Column(name = "user_name")
    private String name;
    @Column(name = "user_head_image")
    private String userHeadImage="https://wjt-1306520233.cos.ap-chengdu.myqcloud.com/brand/48371626191416055.jpg";
    @Column(name = "user_loginTime")
    @JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date loginTime;

    @Column(name = "user_regTime")
    @JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date regTime;

    @Column(name = "user_token")
    private String token;

    @Column(name = "user_status")
    private Boolean status=false;

    @Column(name = "user_delete")
    private Boolean delete=false;
}
